<?php
use common\service\StaticService;
use common\service\GlobalUrlService;
use backend\assets\AdminAsset;
 StaticService::includeAppJsStatic(GlobalUrlService::buildStaticUrl('/backend/supplier/index.js'),AdminAsset::class);
?>
<div class="layui-card">
    <div class="layui-card-header">供货商品列表</div>
    <div class="layui-card-body">
        <div class="layui-form-item">
            <form method="get" class="layui-form" id="serch-form" action="<?php GlobalUrlService::buildAdminUrl('supplier/index') ?>">
                名称:
                <div class="layui-inline">
                    <input type="text"  name="goods_name" class="layui-input"  value="" />
                </div>
                商家状态:
                <div class="layui-inline">
                    <select class="oneclass" name="tree_id" lay-filter="one">
                        <option value="0">请选择一级分类</option>
                        <?php foreach ($trees as $val):?>
                            <option value="<?=$val['id']?>"><?=$val['tree_name']?></option>
                        <?php endforeach;?>
                    </select>
                </div>
                <div class="layui-inline">
                    <select class="twoclass" name="two_id" lay-filter="two">
                        <option value="0">请选择二级分类</option>
                        <?php if(!empty($twodata)):?>
                            <?php foreach ($twodata as $val):?>
                                <option value="<?=$val['id']?>" <?php if ($two_id == $val['id']):?>selected<?php endif?> > <?= $val['tree_name']?> </option>
                            <?php endforeach;?>
                        <?php endif;?>
                    </select>
                </div>
                <div class="layui-inline">
                    <select class="threeclass" name="three_id">
                        <option value="0">请选择三级分类</option>
                        <?php if(!empty($threedata)):?>
                            <?php foreach ($threedata as $val):?>
                                <option value="<?= $val['id']?>" <?php if ($three_id == $val['id']):?>selected<?php endif?>><?= $val['tree_name']?></option>
                            <?php endforeach;?>
                        <?php endif;?>
                    </select>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn" lay-submit lay-filter="serch-form">搜索</button>
                </div>
                <div class="layui-inline">
                    <a href="<?= GlobalUrlService::buildAdminUrl('supplier/add')?>" class="layui-btn layui-btn-normal">添加商品</a>
                </div>
            </form>
        </div>
        <div class="layui-form-item">
            <table class="layui-hide" id="test"  lay-filter="barDemo"></table>
        </div>
    </div>
</div>



<script type="text/html" id="img">
    <img src="{{d.avatarurl}}"/>
</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    {{# if(d.status == 0){ }}
    <a class="layui-btn layui-btn-xs" lay-event="up">上架</a>
    {{# }else if(d.status == 1){ }}
    <a class="layui-btn layui-btn-xs" lay-event="down">下架</a>
    {{# } }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
</script>
<script type="text/html" id="SKU">
    <a class="layui-btn layui-btn-xs" lay-event="sku">查看商品SKU</a>
</script>
